﻿using System.Threading.Tasks;
using Devonline.Entity;

namespace Devonline.MessageCenter
{
    public interface IMessageClient<TMessage, TKey, TContent> : IChannelClient<TMessage> where TMessage : class, IMessage<TKey, TContent>
    {
        /// <summary>
        /// 客户端收到通知时的处理方法
        /// </summary>
        /// <param name="message"></param>
        /// <returns></returns>
        Task Notice(TMessage message);
        /// <summary>
        /// 客户端收到预警类型消息的处理方法
        /// </summary>
        /// <param name="message"></param>
        /// <returns></returns>
        Task Alarm(TMessage message);
        /// <summary>
        /// 客户端接收 Message 消息的方法
        /// </summary>
        /// <param name="message"></param>
        /// <returns></returns>
        Task Reply(TMessage message);
        /// <summary>
        /// 客户端接收消息回执的方法
        /// </summary>
        /// <param name="id">消息编号</param>
        /// <returns></returns>
        Task Ack(TKey id);
        /// <summary>
        /// 客户端接收消息已读的方法
        /// </summary>
        /// <param name="id">消息编号</param>
        /// <returns></returns>
        Task Read(TKey id);
    }

    /// <summary>
    /// 字符串作为主键的通用 message 类型的消息通道
    /// </summary>
    /// <typeparam name="TContent"></typeparam>
    public interface IMessageClient<TContent> : IMessageClient<Message<TContent>, string, TContent>
    {
    }
}
